package io.github.wppli.infrastructure.persistent.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * <p>
 * 
 * </p>
 *
 * @author lijiaqiang@ljq1024.cc
 * @since 2025-03-04
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("private_message")
public class PrivateMessage implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 消息ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 发送这ID
     */
    @TableField("sender_id")
    private Long senderId;

    /**
     * 接收者ID
     */
    @TableField("receiver_id")
    private Long receiverId;

    /**
     * 发送的正文
     */
    @TableField("content")
    private String content;

    /**
     * 是否已读
     */
    @TableField("is_read")
    private Integer isRead;

    /**
     * 是否撤回
     */
    @TableField("is_retracted")
    private Integer isRetracted;

    /**
     * 发送时间 时间格式化注解
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
    @TableField("send_time")
    private LocalDateTime sendTime;

    /**
     * 发送者用户名
     */
    @TableField("sender_user_name")
    private String senderUserName;

}
